package com.xcc.server.demo;

import com.xcc.server.Server;
import com.xcc.server.domains.enums.MessageType;
import com.xcc.server.domains.vo.Message;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Author: xcc
 * @Date: 2021/2/5 13:41
 * @Description:
 */
public class ServerMain {

    public static void main(String[] args) throws InterruptedException, IOException {
        final Server server = new Server(9999);
        new Thread(new Runnable() {
            public void run() {
                try {
                    server.start();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while (true) {
            String message = br.readLine();
            Message message1 = new Message();
            message1.setBody(message);
            message1.setMessageType(MessageType.BODY);
            server.sendMessage("123", message1);
        }



    }
}
